import http from "@/api";
import { ResPage } from "@/api/interface/index";
import { Variable } from "@/api/interface/iot";
// import { Device, Variable } from "@/api/interface/iot";
// import { getDeviceListALl } from "./device";

export const getPageList = async (params: Variable.ReqVariable) => {
	// let res = await getDeviceListALl({ pageIndex: 1, pageSize: 9999 });
	// params.sns = res.result?.records?.map((record: Device.ResDeviceInfo) => record.sn).join(",");
	return http.get<ResPage<Variable.ResVariable[]>>(`/variable/find`, params);
};
export const getInfo = (params: Variable.ReqVariable) => {
	return http.get<Variable.ResVariable>(`/variable/get`, params);
};
export const addInfo = (params: Variable.ResVariable) => {
	return http.post(`/variable/add`, params);
};
export const modInfo = (params: Variable.ResVariable) => {
	return http.post(`/variable/modify`, params);
};
export const delInfo = (params: Variable.DelVariable) => {
	return http.post(`/variable/remove`, params);
};
export const exportVariableExcel = (params: { [key: string]: any }) => {
	return http.downloadGet("/variable/export", params, { responseType: "blob" });
};
export const importVariableExcel = (params: FormData) => {
	return http.post(`/variable/import`, params);
};
